package com.xiaoshuidi.cloud.module.contract.enums.bill;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

@Getter
@AllArgsConstructor
public enum PayMethodEnum {

    UNPAID("支付宝", "线上"),
    PAID("微信", "线上"),
    PART("银行转账", "线下"),
    POS("POS", "线下"),
    CASH("现金", "线下"),
    FUYOU("富友支付", "线上"),
    ALIPAY("支付宝支付", "线上"),
    WXPAY("微信支付", "线上"),
    ;
    private final String code;
    private final String msg;

    private static Map<String, PayMethodEnum> enumMap = new HashMap<>();
    static {
        PayMethodEnum[] values = PayMethodEnum.values();
        for (PayMethodEnum value : values) {
            enumMap.put(value.getCode(), value);
        }
    }
    public static PayMethodEnum getEnum(String num){
        return enumMap.get(num);
    }

    public static PayMethodEnum getPayMethod(String code) {
        PayMethodEnum[] payMethodEnums = values();
        for (PayMethodEnum payMethodEnum : payMethodEnums) {
            if (payMethodEnum.code==code) {
                return payMethodEnum;
            }
        }
        return null;
    }
}
